<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>承运商管理（物流后台的客户管理）</title>
    <link rel="stylesheet" href="http://static-online.zhaogangtest.com/publicresource/css/bootstrap-table.css">
    <link rel="stylesheet" href="../../../resources/public/css/bootstrap-table-fixed-columns.css">
    <link rel="stylesheet" href="http://static-online.zhaogangtest.com/publicresource/control/daterangpicker/daterangepicker-bs3.css">
    <link rel="stylesheet" href="../../../resources/public/css/table.css">
    <link rel="stylesheet" href="../../../resources/public/css/iconfont.min.css">
    <link rel="stylesheet" href="../../../resources/public/css/scmstrap.css">
</head>

<body>
    <div class="main">
        <!-- 条件区域 -->
        <div class="form-list">
            <div class="group">
                <label>公司</label>
                <div class="scm-input-wrap">
                    <input type="text" class="scm-input" value="委托方公司">
                </div>
            </div>
            <div class="group">
                <label>联系人</label>
                <div class="scm-input-wrap">
                    <input type="text" class="scm-input" value="联系人、联系方式">
                </div>
            </div>
            <div class="group group-select">
                <label>状态</label>
                <div class="selectshow selectshowAction scm-input-wrap">
                    <input type="text" class="scm-input hand" readonly="" placeholder="全部">
                </div>
                <ul class="select" style="display: none;">
                    <li>全部</li>
                    <li>未结单</li>
                    <li>已结单</li>
                </ul>
            </div>
            <div class="group group-double-select">
                <div class="group group-select">
                    <label>交易员</label>
                    <div class="selectshow selectshowAction scm-input-wrap">
                        <input type="text" class="scm-input hand" readonly="" placeholder="全部">
                    </div>
                    <ul class="select" style="display: none;">
                        <li>全部</li>
                        <li>未结单</li>
                        <li>已结单</li>
                    </ul>
                </div>
                <div class="group group-select group-select-nolabel">
                    <div class="selectshow selectshowAction scm-input-wrap">
                        <input type="text" class="scm-input hand" readonly="" placeholder="全部">
                    </div>
                    <ul class="select" style="display: none;">
                        <li>全部</li>
                        <li>未结单</li>
                        <li>已结单</li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 按钮 -->
        <div class="operation">
            <div class="conditionbtn">
                <button class="scm-btn blue">
                    <i class="anticon icon-search1"></i>查询</button>
            </div>
            <div class="scm-btn-group fr">
                <button class="scm-btn btn-add-item">
                    <i class="anticon icon-plus"></i>新增
                </button>
                <button class="scm-btn btn-adjust-item">
                    <i class="anticon icon-check"></i>启用
                </button>
                <button class="scm-btn btn-adjust-item">
                    <i class="anticon icon-close"></i>禁用
                </button>
            </div>
        </div>
        <div class="box-table">
            <table class="table table-condensed" id="table-parent"></table>
        </div>
    </div>
     <!-- 操作 -->
    <div class="layer-reset-password" style="display: none">
        <p class="layer-tips"><i class="anticon icon-exclamationcircle fs17 brown"></i>当前联系人账号为空，操作失败</p>
    </div>
    <script src="http://static-online.zhaogangtest.com/publicresource/js/require.js"></script>
    <script>
    var page;

    require.config({
        paths: {
            "jquery": "../../../resources/public/js/jquery.min",
            "bootstrap": 'http://static-online.zhaogangtest.com/publicresource/js/bootstrap.min',
            // "bootstrap-table": "http://static-online.zhaogangtest.com/publicresource/js/bootstrap-table",
            "bootstrap-table": "../../../resources/public/js/bootstrap-table",
            "moment": "http://static-online.zhaogangtest.com/publicresource/control/daterangpicker/moment.min",
            "daterangepicker": "../../../resources/public/js/daterangepicker",

            "layer": 'http://static-online.zhaogangtest.com/publicresource/control/layer/layer.min',
            "public": "../../../resources/public/js/public",
            "chinese": "../../../resources/public/js/chinese",
            "bootstrap-table-fixed": "../../../resources/public/js/bootstrap-table-fixed-columns",
            "autocomplete": "../../../resources/public/js/jquery.autocomplete",
        },
        shim: {
            "jquery": {
                exports: ['jQuery', '$']
            },
            "bootstrap": {
                deps: ["jquery"]
            },
            "bootstrap-table": {
                deps: ["jquery", "bootstrap"]
            },
            "bootstrap-table-fixed": {
                deps: ["bootstrap-table"]
            },
            "layer": {
                deps: ["jquery"],
                exports: "layer"
            },
            "autocomplete": {
                deps: ['jquery']
            },
            "moment": {
                deps: ['jquery']
            },
            "daterangepicker": {
                deps: ["jquery", "moment"],
                exports: "daterangepicker"
            },
            "chinese": {
                deps: ["jquery", "bootstrap-table"],
            },

            "public": {
                deps: ["jquery", "bootstrap-table", "moment", "daterangepicker"]
            }
        }
    });
    require(["autocomplete", "public", "layer", "chinese", "bootstrap-table-fixed"], function() {
        layer.config({
            path: 'http://static-online.zhaogangtest.com/publicresource/control/layer/'
        });
        $(function() {
            page = {
                init: function() {
                    this.bootstrapTable();
                    this.autocomplete();
                    this.fn_layer();

                    var that = this;
                    $(window).resize(function() {
                        $('#table-parent').bootstrapTable('resetView', {
                            height: that.getHeight()
                        });
                        $('.daterangepicker').hide()
                    });
                    $.daterangepicker("#datepicker", {
                        singleDatePicker: false,
                    });

                },
                bootstrapTable: function() {
                    $('#table-parent').bootstrapTable({
                        pagination: true, //在表格底部显示分页工具栏
                        pageSize: 50,
                        pageNumber: 1,
                        pageList: [10, 25, 50, 100],
                        height: page.getHeight(),
                        showFooter: true,
                        showColumns: false,
                        showRefresh: false,
                        //                    showToggle:true,
                        search: false,
                        //                    showPaginationSwitch:true,
                        //    detailView: true,
                        //   detailFormatter: page.showdetail,
                        // detailFormatter: this.showChild,
                        // onExpandRow: this.expandRow,
                        // onCollapseRow: this.collapseRow,
                        locales: 'zh-CN',
                        fixedColumns: false,
                        fixedNumber: 1,
                        url: '../data/erp/tablelist-carrier-manage.json',
                        sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）

                        columns: [{
                            "field": "n0",
                            "title": "序号",
                            formatter: function(value, row, index) {
                                return index + 1
                            },
                            footerFormatter: "合计"
                        }, {
                            "field": "n1",
                            "title": "操作",
                            formatter: this.addAction,
                        }, {
                            "field": "n2",
                            "title": "状态",
                        }, {
                            "field": "n3",
                            "title": "公司名称",
                            formatter: this.addCompanyName,
                        }, {
                            "field": "n4",
                            "title": "来源",
                        }, {
                            "field": "n5",
                            "title": "联系人",

                        }, {
                            "field": "n6",
                            "title": "联系方式",
                        }, {
                            "field": "n7",
                            "title": "交易员",
                        }, {
                            "field": "n8",
                            "title": "创建人",
                        }, {
                            "field": "n9",
                            "title": "创建时间",
                        }]
                    });
                },

                fn_layer: function(value, row, index) {
                    $(document).on('click', '.reset-password', function() {
                        layer.open({
                            type: 1, //page层
                            area: ['400px', 'auto'],
                            title: '提示',
                            shadeClose: false,
                            btn: ['确定', '取消'],
                            shade: 0.01, //遮罩透明度
                            moveType: 1, //拖拽风格，0是默认，1是传统拖动
                            shift: -1, //0-6的动画形式，-1不开启
                            content: $('.layer-reset-password'),
                            skin: "skin-searchMore ",
                            yes: function() {}
                        });
                    })

                    $(document).on('click', '.add-companyname', function() {
                        var midata = $(this).attr('mid');
                        parent.unify.fn_detail('erp/erp-carrier-manage-child.html', midata, midata)
                    })
                },
                // 操作
                addAction: function(value, row, index) {
                    if (row.n1 == '123') {
                        return "<div class='tableselect waction2'><div class='tableselect-top'><a href='javascript:;' class='reset-password' mId='"+row.n1+"' mName='"+row.n6+"'>重置密码</a></div></div>";
                    }else{
                        return ""
                    }
                },

                // 公司名称
                addCompanyName: function(value, row, index) {
                    if (row.n3 == '找钢网') {
                        return "<div class='tableselect waction2'><div class='tableselect-top'><a href='javascript:;' class='add-companyname' mId='"+row.n3+"' mName='"+row.n3+"'>找钢网</a></div></div>";
                    }else{
                        return ""
                    }
                },


                autocomplete: function() {
                    var data = ['上海钢找塑料', '上海钢富信息科技有限技有限公司', '上海找油网信息科技', '上海长城实业有限公司',
                        '上海找油网信息科技', '上海长城实业有限公司'
                    ]
                    $("#company input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                    $("#company1 input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap1',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                    $("#company2 input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap2',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                    $("#company3 input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap3',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                    $("#company4 input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap4',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                    $("#company5 input").autocomplete({
                        lookup: data,
                        minChars: 0,
                        appendTo: '#companywrap5',
                        onSelect: function(suggestion) {
                            // $(this).val(suggestion.value);
                        },
                    });
                },
                // 表格高度
                getHeight: function() {
                    var _height = $('.form-list').outerHeight(
                        true) + $('.operation').outerHeight(true)
                    return $(window).height() - _height - 20;
                },
            }
            page.init();
        })
    })
    </script>
</body>

</html>